--- If Your function return type is BINARY_INTEGER or PLS_INTEGER
--- You can use the following function in a SQL statement
create or replace function GET_SAL(P_EMPNO NUMBER)
return pls_integer is
Result pls_integer ;
begin
SELECT SALARY INTO RESULT
FROM EMPLOYEES
WHERE EMPLOYEE_ID=P_EMPNO;
return(Result);
EXCEPTION
WHEN NO_DATA_FOUND THEN
RETURN -1;
end GET_SAL;
/